#include <stdio.h>
#include <string.h>

const int maxn = 1e6 + 17;
int n, rmb[maxn];

//加个记忆化
int f(int x) {
	if(rmb[x] != -1) return rmb[x];
	return rmb[x] = f(x - 1) + f(x - 2);
}

//更能体现递归思想的版本，然而复杂度感人
int g(int x) {
	if(x == 1) return rmb[1];
	if(x == 2) return rmb[2];
	return g(x - 1) + g(x - 2);
}

int main() {
	memset(rmb, -1, sizeof(rmb));
	printf("Please enter the first term of the sequence.\n");
	scanf("%d", &rmb[1]);
	printf("Please enter the second term of the sequence.\n");
	scanf("%d", &rmb[2]);
	printf("Please enter the numbers of terms you want to output.\n");
	scanf("%d", &n);
	printf("The sequence is : \n");
	for(int i = 1; i <= n; i++) printf("%d%c", f(i), " \n"[i == n]);
	// for(int i = 1; i <= n; i++) printf("%d%c", g(i), " \n"[i == n]);
	return 0;
}